package com.example.mapp;

import com.example.entity.supervision.CheckItem;
import com.example.entity.supervision.PlanDictItem;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * Created by simon on 2018/8/7.
 */
@Mapper
public interface PlanDictItemMapp {

    @Insert(" insert into plan_dict_item (p_dict_id, item_id,ext1, ext2) " +
            " value (#{pDictId},#{itemId},#{ext1},#{ext2}) ")
    @SelectKey(statement = "select last_insert_id()", keyProperty = "id", keyColumn = "id", before = false, resultType = Long.class)
    int insert(PlanDictItem planDictItem) throws Exception;

    @Select("select b.id, b.item_name,b.item_type, b.item_no, b.is_use, b.item_content from check_item b " +
            "left join plan_dict_item a on a.item_id = b.id where a.p_dict_id=#{pDictId}  ")
    List<CheckItem> query(Map map) throws Exception;

    @Delete("delete from plan_dict_item where p_dict_id=#{pDictId}")
    int deleteByDictId(PlanDictItem map) throws Exception;
}
